Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Captions 🏷️ #3406

Merged
merged 1 commit into from
Nov 16, 2023
Merged

File Captions 🏷️ #3406

merged 1 commit into from
Nov 16, 2023

Conversation

rapterjet2004
Copy link
Contributor

@rapterjet2004 rapterjet2004 commented Oct 24, 2023

🖼️ Screenshots

Current impl

image image

🚧 TODO

  • Implement New Dialog Fragment to handle captions
    • Layout
    • Fragment
  • Redo metadata implementation to include caption
  • Render captioned attachments
    • Outgoing Messages
    • Incoming Messages
    • Render mentions correctly
    • Sharing from Device
    • fix file captions order and not disappearing
    • Sharing from Photo and Video
  • Test it, a lot (also delete all those pictures from sermo)
  • Review

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

@rapterjet2004 rapterjet2004 added enhancement New feature or request 2. developing Work in progress feature: 🗨️ chat labels Oct 24, 2023
@rapterjet2004 rapterjet2004 self-assigned this Oct 24, 2023
@rapterjet2004 rapterjet2004 force-pushed the issue-3290-file-caption branch from 5100228 to 4326c7e Compare October 31, 2023 16:25
@mahibi
Copy link
Collaborator

mahibi commented Nov 3, 2023

Hi, I just stumbled across the screenshots that already show a draft for the "multiple images" feature.
The feature is postponed for now afaik, but I think we should align with the design of Server and iOS when it comes up.
So maybe @nickvergessen wants to keep this in mind when an overview ticket is created...?
Just want to make sure it's not totally different on each platform..

@nickvergessen
Copy link
Member

Yeah multiple images are not part of the current scope

@rapterjet2004 rapterjet2004 force-pushed the issue-3290-file-caption branch from eca3dad to 7f864ce Compare November 3, 2023 12:46
@AndyScherzinger AndyScherzinger marked this pull request as ready for review November 3, 2023 14:06
@rapterjet2004 rapterjet2004 force-pushed the issue-3290-file-caption branch from 97e9024 to 37e3458 Compare November 3, 2023 14:15
@rapterjet2004 rapterjet2004 added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Nov 3, 2023
@rapterjet2004 rapterjet2004 force-pushed the issue-3290-file-caption branch from 37e3458 to ec77c5a Compare November 3, 2023 14:41
@@ -49,7 +54,36 @@ public IncomingPreviewMessageViewHolder(View itemView, Object payload) {
@Override
public void onBind(@NonNull ChatMessage message) {
super.onBind(message);

if(!message.isVoiceMessage()) {
assert viewThemeUtils != null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will crash when not null, so I would suggest to implement it more defensive, as in skip if null, applies also for the below uses of assert where I would advise against in general.

@@ -48,6 +53,38 @@ public OutcomingPreviewMessageViewHolder(View itemView) {
public void onBind(ChatMessage message) {
super.onBind(message);

if(!message.isVoiceMessage()) {
assert viewThemeUtils != null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here


</LinearLayout>

</LinearLayout>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add empty line on the bottom

@AndyScherzinger
Copy link
Member

from a visual perspective it be nice if the image and the caption could be combined so it looks more like a single message. With the current layout it looks like a image message and a text message.

@rapterjet2004 rapterjet2004 force-pushed the issue-3290-file-caption branch from ec77c5a to 82952dd Compare November 7, 2023 16:07
@rapterjet2004
Copy link
Contributor Author

image

@AndyScherzinger

@AndyScherzinger
Copy link
Member

AndyScherzinger commented Nov 7, 2023

@rapterjet2004 visual change looks great 👍 smallest papercut, please add some padding to filename and date so it matches the caption text's padding from the bubble. 👍👍👍

@mahibi
Copy link
Collaborator

mahibi commented Nov 8, 2023

great 👍

i saw some bugs when testing.
how to reproduce:

  1. take photo & add caption
  2. take another photo & add without caption
  • after second photo is posted, for first photo, "{file}" is shown as caption
  • for second photo, the bubble is shown also around filename and date, but only until chat refreshes. then no bubble is shown.
fileCaptionTest1.mp4

@AndyScherzinger AndyScherzinger added this to the 18.0.0 milestone Nov 8, 2023
@rapterjet2004
Copy link
Contributor Author

issue-3290-file-caption-1.webm

I think I fixed it, but can you double check? @mahibi

@rapterjet2004 rapterjet2004 force-pushed the issue-3290-file-caption branch from d94e964 to 76651b1 Compare November 8, 2023 16:02
@AndyScherzinger AndyScherzinger self-requested a review November 8, 2023 17:20
@rapterjet2004 rapterjet2004 force-pushed the issue-3290-file-caption branch from 76651b1 to f1bf83f Compare November 9, 2023 13:38
@mahibi
Copy link
Collaborator

mahibi commented Nov 13, 2023

issue-3290-file-caption-1.webm

I think I fixed it, but can you double check? @mahibi

  • for me, there are no bubbles now for captions.
  • when i click on a caption it crashes:
 2023-11-13 15:20:52.141 27927-27927 AndroidRuntime          com.nextcloud.talk2                  E  FATAL EXCEPTION: main
                                                                                                    Process: com.nextcloud.talk2, PID: 27927
                                                                                                    android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
                                                                                                    	at android.app.ContextImpl.startActivity(ContextImpl.java:1140)
                                                                                                    	at android.app.ContextImpl.startActivity(ContextImpl.java:1116)
                                                                                                    	at android.content.ContextWrapper.startActivity(ContextWrapper.java:441)
                                                                                                    	at com.nextcloud.talk.utils.message.MessageUtils.processMessageParameters$lambda$0(MessageUtils.kt:146)

@rapterjet2004 rapterjet2004 force-pushed the issue-3290-file-caption branch from 0aa5ada to 21b7264 Compare November 13, 2023 14:45
@rapterjet2004
Copy link
Contributor Author

@mahibi that should have fixed it. I was theming the background, before setting it, which is why the bubble wasn't appearing, and I made it so that the caption and background should be unclickable.

- Added dialog_file_attachment_preview.xml
- Added FileAttachmentPreviewFragment.kt
- Edited ChatActivity to add captions to uploaded files, also refactored some code
- Edited the Outgoing, Incoming, and Generic Preview holders to have a caption
- Fixed some bugs with RemoteFileBrowser

Signed-off-by: Julius Linus <[email protected]>
@mahibi mahibi force-pushed the issue-3290-file-caption branch from 5b54dea to 5e362ae Compare November 16, 2023 14:47
@mahibi mahibi merged commit f6f9f35 into master Nov 16, 2023
14 of 15 checks passed
@delete-merged-branch delete-merged-branch bot deleted the issue-3290-file-caption branch November 16, 2023 14:48
@mahibi
Copy link
Collaborator

mahibi commented Nov 16, 2023

Well done @rapterjet2004 👍

Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings8989
Errors00

SpotBugs

CategoryBaseNew
Bad practice66
Correctness1010
Dodgy code123123
Internationalization55
Malicious code vulnerability33
Performance88
Security22
Total157157

Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/3406-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support "File caption"
4 participants